<template>
  <view class="container_cart">
    <view class="container_cart_header">
      <view class='container_cart_title'>
        <view>购物车</view>
        <view class='container_cart_address'>
          <view v-if="addressList.length > 0" :style="{ display: 'flex', alignItems: 'center' }" @click="onAddressShow()">
            <text>{{ defaultAddress.detail }}</text>
            <u-icon name="arrow-right-double" color="#FFF" size="16"></u-icon>
          </view>
          <view v-else :style="{ display: 'flex', alignItems: 'center' }" @click="goAddress('add')">
            <text>暂无收货地址，快去新建吧</text>
            <u-icon name="arrow-right-double" color="#FFF" size="16"></u-icon>
          </view>
        </view>
      </view>
      <view>
        <view>共{{ cartList.length }}件</view>
        <view @click="onManageCart()" v-if="cartList.length != 0">
          <text v-if="manageStatus" :style="{ color: '#EA5F5F' }">退出管理</text>
          <text v-else>管理</text>
        </view>
      </view>
    </view>

    <view class='container-cart-section'>
      <view class='cart-list' v-if="cartList.length != 0">
        <view class='cart-items' v-for="item in cartList" :key="item.id">
          <u-checkbox @change="handleCheckGoods(item, $event)" activeColor="#32B499" shape="circle"
            :checked="item.checked" v-if="item.status == 1 || manageStatus"></u-checkbox>
          <u-checkbox activeColor="#32B499" shape="circle" disabled v-else></u-checkbox>
          <view class='cart-items-img flex-box' @click="$goPath(2, `/pages/pocketShop/home/goodsDetail?productId=${item.productId}`)">
            <image :src="item.thumbnailUrl" mode='aspectFit|aspectFill|widthFix' alt=""></image>
            <view class="limit-icon" v-if="item.limitation == 1">限购{{ item.limitationCount }}件</view>
            <view class="status" v-if="item.status == 0">
              商品已下架
            </view>
          </view>
          <view class='cart-items-content'>
            <view class='cart-items-content-name' @click="$goPath(2, `/pages/pocketShop/home/goodsDetail?productId=${item.productId}`)">{{ item.productName }}</view>
            <view class='cart-items-content-limitationSell' v-if="item.limitation == 1">
              {{ item.limitationSell == 0 ? `限购${item.limitationCount}件` :
                `限购${item.limitationCount}件，第${item.limitationCount + 1}件恢复原价` }}
            </view>
            <view class='cart-items-content-price'>
              <view class='price' v-if="item.limitation == 1">
                <view>￥<text>{{ item.limitationPrice }}</text></view>
                <view>￥<text>{{ item.showPrice }}</text></view>
              </view>
              <view v-else>￥<text>{{ item.showPrice }}</text></view>
              <view class='cart-items-content-num' v-if="item.status == 1">
                <view class='minus flex-box'>
                  <u-icon color="#333" size="16" name="minus" @click="handleChangeNum(item, 'minus')"></u-icon>
                </view>
                <view class='number flex-box'>
                  <input type="text" :value="item.count" @blur="handleInputChange(item, $event)" />
                </view>
                <view class='add flex-box'>
                  <u-icon color="#333" size="16" name="plus" @click="handleChangeNum(item, 'add')"></u-icon>
                </view>
              </view>
            </view>
          </view>
        </view>
      </view>

      <view v-else class="cart-empty">
        <image
          src="https://youpindou.com:8083/doudougou/image/showImg?imgUrl=/home/ddg_test/images/3b838297-ad51-4cab-b31d-0b9f568f7a6d.png"
          mode="aspectFit|aspectFill|widthFix"></image>
        <view>这里暂时什么都没有哦</view>
      </view>
    </view>

    <view class='cart-settlement' v-if="cartList.length != 0">
      <u-checkbox-group v-model="isCheckAll" @change="checkAll">
        <u-checkbox activeColor="#32B499" shape="circle" label="全选" name="全选"></u-checkbox>
      </u-checkbox-group>

      <view class='account-btn flex-box' v-if="manageStatus" :style="{ backgroundColor: '#EA5F5F' }"
        @click="deleteCart()">删除</view>
      <view class='cart-settlement-right' v-else>
        <view>已选{{ checkedList.length }}件</view>
        <view class='cart-settlement-right-sum'>
          合计<text>￥</text><text>{{ totalMoney }}</text>
        </view>
        <view class='account-btn flex-box' @click="goPay()">结算</view>
      </view>
    </view>

    <uni-popup ref="visiablePopup" style="z-index: 1000;">
      <view class='cartAddress-popup'>
        <view class="popup_title">收货地址</view>
        <view class='popup_operate'>
          <view @click="goAddress('add')">新增</view>
          <view @click="goAddress('edit')">管理</view>
        </view>
        <section>
          <u-radio-group v-model="addressChecked" placement="column">
            <view class='address-item' v-for="(item, index) in addressList" :key="index" @click="onCheckAddress(item)">
              <view>
                <image class='address-item-defaultImg' src="https://youpindou.com/miniProgram/image/showImg?imgUrl=/home/ypd/images/address.png"
                  mode='aspectFit|aspectFill|widthFix' alt="" v-if="item.isDefault == 1" />
                <view class='address-item-name' v-else>{{ item.isDefaultName }}</view>

                <view class='address-item-info'>
                  <view class='address-item-info-contacts'>
                    <text>{{ item.name }}</text>
                    <view>{{ item.phone }}</view>
                    <view class='default' v-if="item.isDefault == 1">默认</view>
                  </view>
                  <view class='address-item-info-address'>{{ `${item.province}${item.city}${item.area} ${item.detail}` }}
                  </view>
                </view>
              </view>
              <view class='address-item-check'>
                <u-radio activeColor="#32B499" shape="circle" :name="item.id"></u-radio>
              </view>
            </view>
          </u-radio-group>
        </section>
      </view>
    </uni-popup>

    <u-modal :show="dialogShow" content="是否确认删除购物车此商品?" showCancelButton @confirm="confirmDel" @cancel="cancelDel"
      :closeOnClickOverlay="true"></u-modal>
      <u-modal :show="showParent" content="您还未绑定上级用户,是否要前往绑定?" cancelText="忽略" confirmText="前往绑定" showCancelButton @confirm="confirmParent" @cancel="cancelParent"></u-modal>
    <tabbar :currentTab='1' :type="0" />
  </view>
</template>

<script>
import { getUserInfo } from '@/common/auth';

export default {
  data() {
    return {
      isCheckAll: [],
      cartList: [],
      totalMoney: '0.00', //总价
      checkedList: [], //购买 选中的商品列表
      deleteList: [], //删除 选中的商品列表
      manageStatus: false, //true 状态变成删除
      visiable: false, //二次确认弹窗 删除商品
      addressList: [], //收货地址列表
      defaultAddress: {}, //选择的收货地址 默认取列表的第一条
      dialogShow: false,
      addressChecked: 0,
      value: 2,
      showParent:false
    }
  },
  onShow() {
    if (!getUserInfo()) return
    this.getCartList();
    this.getAddressList();
  },
  onLoad() {
    //隐藏官方的tabBar
    uni.hideTabBar()
  },
  methods: {
    //获取购物车列表
    async getCartList() {
      let userInfo = getUserInfo()
      let result = await this.$request.shoppingList({ userId: userInfo.userId })
      if (this.cartList.length == 0) {
        result.data.map(item => {
          item.checked = false;
        });
		this.checkedList = []
      } else {
        let checkedArr = [];
        result.data.map((item, index) => {
          item.checked = false;
          item.checked = this.cartList[item.id]?.checked;
          if (item.checked) {
            checkedArr.push(item);
          }
        });
        this.checkedList = checkedArr;
      }
      this.cartList = result.data;
	  this.isCheckAll = []
	  
      this.getTotalPrice(result.data);
    },

    //获取收货地址列表
    async getAddressList() {
      let userInfo = getUserInfo()
      let result = await this.$request.myAddress({ userId: userInfo.userId })
      result.data.map(item => {
        item.isChecked = false;
        if (!item.isDefault) {
          item.isDefaultName = item.name.slice(0, 1);
        }
      });
      if (result.data.length > 0) {
        this.addressChecked = result.data[0].id;
        result.data[0].isChecked = true;
      }
      this.addressList = result.data;
      this.defaultAddress = result.data[0];
    },

    //管理购物车
    onManageCart() {
      let list = [...this.cartList];
      list.map(item => {
        item.checked = false;
      });
      this.cartList = list;
      this.manageStatus = !this.manageStatus;
      this.checkedList = [];
      this.deleteLis = [];
      this.totalMoney = '0.00';
      this.isCheckAll = [];
    },
    //收货地址列表展示
    onAddressShow() {
      this.$refs.visiablePopup.open('bottom');
    },
    //新建/修改收货地址
    goAddress(type) {
      let addressItem = {};
      let userInfo = getUserInfo()
      if (!userInfo) return this.$toast('您还未登录，先去登录吧')
      this.addressList.map(item => {
        if (item.isChecked) {
          addressItem = item;
        };
      });
      this.$goPath(2, `/pagesA/pocketShop/mine/editAddress?type=${type}&detail=${JSON.stringify(addressItem)}`)
    },
    //改变购物车商品数量
    handleInputChange(item, e) {
      e.stopPropagation();
      let userInfo = getUserInfo()
      const { value } = e.target;
      let isAdd = true;
      if (!value) {
        uni.showToast({ title: '请输入商品数量', icon: 'none' });
        return;
      }
      if (item.limitation == 1) {
        if (value > item.limitationCount) {
          isAdd = false;
          if (item.limitationSell) {
            uni.showToast({ title: '用户购买超过限购数量，超过部分根据原价销售', icon: 'none' });
            isAdd = true;
          } else {
            uni.showToast({ title: '用户购买超过限购数量，不可购买', icon: 'none' });
          }
        }
      }

      if (isAdd) {
        const param = { count: value, productId: item.productId, userId: userInfo.userId, id: item.id };
        this.$request.shoppingUpdate(param).then(res => {
          if (res.code == 200 && res.isSuccess) {
            this.getCartList();
            uni.showToast({ title: '数量修改成功', icon: 'success' });
          }
        });
      }
    },

    //数字加加减减
    handleChangeNum(item, type) {
      let userInfo = getUserInfo()
      if (type == 'minus') {
        if (item.count > 1) {
          let num = item.count - 1;
          const param = { count: num, productId: item.productId, userId: userInfo.userId, id: item.id };
          this.$request.shoppingUpdate(param).then(res => {
            if (res.code == 200 && res.isSuccess) {
              this.getCartList();
            }
          });
        } else {
          uni.showToast({ title: '该宝贝不能再减少了', icon: 'none' });
        }
      } else {
        let isAdd = true;
        if (item.limitation == 1) {
          if (item.count + 1 > item.limitationCount) {
            isAdd = false;
            if (item.limitationSell) {
              uni.showToast({ title: '用户购买超过限购数量，超过部分根据原价销售', icon: 'none' });
              isAdd = true;
            } else {
              uni.showToast({ title: '用户购买超过限购数量，不可购买', icon: 'none' });
            }
          }
        }

        if (isAdd) {
          let num = item.count + 1;
          const param = { count: num, productId: item.productId, userId: userInfo.userId, id: item.id };
          this.$request.shoppingUpdate(param).then(res => {
            if (res.code == 200 && res.isSuccess) {
              this.getCartList();
            }
          });
        }
      };
    },

    checkAll(event) {
      let list = [...this.cartList];
      let checkArr = [];
      let delArr = [];
      list.map(item => {
        if (item.status == 1 || this.manageStatus) {
          item.checked = event.length > 0 ? true : false;
          if (event) {
            if (this.manageStatus) {
              delArr.push(item);
            } else {
              checkArr.push(item);
            }
          }
        }
      });
      this.getTotalPrice(list);
      this.cartList = list;
      this.checkedList = event.length > 0 ? checkArr : [];
      this.deleteList = delArr;
      this.isCheckAll = event;
    },

    //选择单个商品
    handleCheckGoods(item, event) {
      let checkArr = [];
      let delArr = [];
      let isCheckAllStatus = true;
      let list = [...this.cartList];
      list.map(ite => {
        if (ite.id == item.id) {
          ite.checked = event;
        }
        //是否全选
        if (ite.checked === true) return;
        isCheckAllStatus = false;
      });

      //选中后 购买或删除
      list.map(ite => {
        if (this.manageStatus) {
          if (ite.checked) {
            delArr.push(ite);
          }
        } else {
          if (ite.checked) {
            checkArr.push(ite);
          }
        }
      });
      this.getTotalPrice(list);
      this.cartList = list;
      this.checkedList = checkArr;
      this.deleteList = delArr;
      this.isCheckAll = isCheckAllStatus ? ['全选'] : [];
    },

    //获取已选中商品的总价
    getTotalPrice(list) {
      let sum = 0.00;
      list.map(item => {
        if (item.checked) {
          console.log(item.limitation)

          if (item.limitation == 0) {
            sum += item.totalPrice;
          } else {
            // if (!item.purchasedCount) {
            //   item.purchasedCount = 0;
            // }
            // if (item.purchasedCount >= item.limitationCount && item.purchasedCount) {
            //   sum += item.showPrice * item.count;
            // } else if (item.count + item.purchasedCount > item.limitationCount) {
            //   sum += ((item.limitationPrice * (item.limitationCount - item.purchasedCount)) + ((item.count - (item.limitationCount - item.purchasedCount)) * item.showPrice));
            // } else {
            //   sum += item.limitationPrice * item.count;
            // }
            // 以前没买过
            if (!item.purchasedCount) {
              if (item.count <= item.limitationCount) {
                // 还有限购数量
                sum += item.count * item.limitationPrice
              } else {
                // 没有限购数量
                sum += (item.limitationCount * item.limitationPrice) + (item.count - item.limitationCount) * item.showPrice
              }
            } else {
              // 以前买过
              if (item.purchasedCount >= item.limitationCount) {
                // 以前直接买超
                sum += item.count * item.showPrice
              } else {
                // 以前没有买超
                // sum+=item.count*item.limitationPrice
                if ((item.count + item.purchasedCount) <= item.limitationCount) {
                  // 现在和以前加起来都没有买超
                  sum += item.count * item.limitationPrice
                } else {
                  sum += (item.limitationCount - item.purchasedCount) * item.limitationPrice + (item.count - (item.limitationCount - item.purchasedCount)) * item.showPrice
                }
              }
            }
          }
        }
      });
      this.totalMoney = sum.toFixed(2);
      console.log(this.totalMoney, 'this.totalMoney')

    },

    //去结算
    goPay() {
      const { checkedList, addressList, defaultAddress } = this;
      if (checkedList.length == 0) return this.$toast('请先选择商品!')
      if (addressList.length == 0) return this.$toast('暂无收货地址，快去新建吧!')
      let parent = getUserInfo().parent
      if (parent == 0 || parent == '') {
        this.showParent = true
      }else{
        uni.navigateTo({ url: `/pagesA/pocketShop/mine/confirmOrder?defaultAddress=${encodeURIComponent(JSON.stringify(defaultAddress))}&goodsList=${encodeURIComponent(JSON.stringify(checkedList))}` });
      }
    },
    confirmParent(){
      this.showParent = false
      this.$goPath(2,`/pagesA/pocketShop/mine/bindCode`)
    },
    // 忽略
    cancelParent(){
      this.showParent = false
      uni.navigateTo({ url: `/pagesA/pocketShop/mine/confirmOrder?defaultAddress=${encodeURIComponent(JSON.stringify(this.defaultAddress))}&goodsList=${encodeURIComponent(JSON.stringify(this.checkedList))}` });

    },
    //删除已选择商品
    deleteCart() {
      if (this.deleteList.length == 0) {
        uni.showToast({ title: '请选择需要删除的商品', icon: 'none' });
        return;
      };
      this.dialogShow = true;
    },

    //确定删除
    confirmDel() {
      const shoppingCarVO = { idList: [] };
      this.deleteList.map(item => {
        shoppingCarVO.idList.push(item.id)
      });
      this.$request.shoppingDelete(shoppingCarVO).then(res => {
        if (res.code == 200 && res.isSuccess) {
          uni.showToast({ title: '删除成功', icon: 'success' });
          this.getCartList();
          this.dialogShow = false;
        } else {
          uni.showToast({ title: '删除失败，请稍后再试', icon: 'none' });
        }
      });
    },

    //取消删除
    cancelDel() {
      this.dialogShow = false;
    },

    //选择收货地址
    onCheckAddress(detail) {
      let addressDetail = {};
      this.addressList.map(item => {
        if (item.id == detail.id) {
          item.isChecked = true;
          this.addressChecked = item.id;
          addressDetail = detail;
        } else {
          item.isChecked = false;
        }
      });

      this.addressList = this.addressList;
      this.defaultAddress = addressDetail;
      this.$refs.visiablePopup.close();
    }
  }

}
</script>
<style scoped>
.container_cart {
  height: 100vh;
  font-family: 'PingFang SC-Medium';
  font-size: 28rpx;
  color: #333;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #FED14E;
  position: relative;
}

.container_cart_header {
  width: 100%;
  background-color: #32B499;
  background-image: url('https://youpindou.com/miniProgram/image/showImg?imgUrl=/home/ypd/images/images/homeTopIcon.png');
  background-size: 100% auto;
  background-repeat: no-repeat;
  padding: 24rpx;
  padding-top: 100rpx;
  padding-bottom: 72rpx;
  box-sizing: border-box;
  font-size: 28rpx;
  font-family: 'PingFang SC-Medium';
  color: #fff;
  border-radius: 0 0 40rpx 40rpx;
  position: absolute;
  z-index: 1;
}

.container_cart_header>view {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.container_cart_header .container_cart_title {
  align-items: flex-end;
  justify-content: flex-start;
  font-size: 28rpx;
  font-family: 'PingFang SC-Regular';
  margin-bottom: 10px;
}

.container_cart_header .container_cart_title>view:first-child {
  font-size: 40rpx;
  font-family: 'PingFang SC-Bold';
  margin-right: 10rpx;
}

.container_cart_address {
  font-family: 'PingFang SC-Medium';
  font-size: 28rpx;
  padding-bottom: 4rpx;
  box-sizing: border-box;
}

.container_cart_address image {
  width: 8rpx;
  height: 16rpx;
  margin-left: 4rpx;
  display: block;
}

.container-cart-section {
  width: 100%;
  height: 90%;
  padding: 24rpx;
  /* 兼容 iOS < 11.2 */
  /* padding-bottom: calc(constant(safe-area-inset-bottom) + 160rpx); */
  /* 兼容 iOS >= 11.2 */
  /* padding-bottom: calc(env(safe-area-inset-bottom) + 160rpx); */
  box-sizing: border-box;
  position: absolute;
  /* top: 180rpx; */
  top: 110px;
  z-index: 100;
}

.cart-list {
  width: 100%;
  /* height: 100%; */
  height: auto;
  height: 90%;
  background: #FFFFFF;
  border-radius: 20rpx;
  padding: 24rpx;
  padding-bottom: 180rpx;
  box-sizing: border-box;
  top: -60rpx;
  z-index: 100;
  overflow-y: auto;
}

.cart-list .cart-items {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 24rpx;
}

.cart-items-img {
  width: 180rpx;
  height: 180rpx;
  margin-left: 12rpx;
  position: relative;
}

.cart-items-img>image {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 16rpx;
}


.cart-items-img .limit-icon {
  position: absolute;
  left: 0;
  top: 0;
  background-color: #EA5F5F;
  color: #fff;
  border-radius: 8px 0 16rpx 0;
  font-size: 24rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rpx 24rpx;
  box-sizing: border-box;
}

.cart-items-img .status {
  position: absolute;
  color: white;
  font-size: 24rpx;
  background-color: rgb(85 0 0 / 46%);
  padding: 4rpx 10rpx;
  border-radius: 15rpx;
}

.cart-items-content {
  flex: 1;
  margin-left: 20rpx;
  height: 180rpx;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 28rpx;
}

.cart-items-content-name {
  font-size: 28rpx;
  font-family: 'PingFang SC-Bold';
  color: #333;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  /* 设置超过为省略号的行数 */
  overflow: hidden;
}

.cart-items-content-limitationSell {
  font-size: 24rpx;
  width: fit-content;
  padding: 4rpx 20rpx;
  background: #FDF3F3;
  color: #EA5F5F;
  font-family: 'PingFang SC-Medium';
  border-radius: 8rpx;
  box-sizing: border-box;
}

.cart-items-content-price {
  width: 100%;
  color: #EA5F5F;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-items-content-price text {
  font-size: 40rpx;
  font-family: 'DIN-Bold';
}

.cart-items-content-price .price {
  display: flex;
  justify-content: flex-start;
  align-items: flex-end;
}

.cart-items-content-price .price>view {
  font-size: 28rpx;
  font-family: 'DIN-Medium';
  display: flex;
  align-items: flex-end;
}

.cart-items-content-price .price>view:last-child {
  color: #666;
  font-size: 24rpx;
}

.cart-items-content-price .price>view:last-child text {
  text-decoration: line-through;
  font-size: 24rpx;
  color: #666;
  font-family: 'DIN-Medium';
}

.cart-items-content-num {
  display: flex;
  align-items: center;
  width: 180rpx;
  height: 50rpx;
  border: 2rpx solid #999999;
  border-radius: 8rpx;
}

.cart-items-content-num .minus,
.cart-items-content-num .add {
  width: 52rpx;
  height: 40rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-items-content-num .number {
  flex: 1;
  height: 40rpx;
  border-left: 2rpx solid #999999;
  border-right: 2rpx solid #999999;
  font-family: 'DIN-Regular';
}

.cart-items-content-num .number input {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  text-align: center;
  color: #333;
}

.cart-settlement {
  position: fixed;
  z-index: 100;
  /* bottom: calc(env(safe-area-inset-bottom)); */
  bottom: calc(90rpx + env(safe-area-inset-bottom));
  width: 100%;
  height: 120rpx;
  padding: 0 24rpx;
  background: #FFFFFF;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'PingFang SC-Regular';
  color: #333333;
  font-size: 28rpx;
}

.cart-settlement-right {
  display: flex;
  align-items: center;
}

.cart-settlement-right>view:first-child {
  margin-right: 10rpx;
}

.cart-settlement-right .cart-settlement-right-sum {
  display: flex;
  align-items: center;
}

.cart-settlement-right .cart-settlement-right-sum text {
  color: #EA5F5F;
}

.cart-settlement-right .cart-settlement-right-sum text:last-child {
  font-size: 40rpx;
  font-family: 'DIN-Medium';
}

.flex-box {
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-btn {
  width: 5rem;
  height: 1.75rem;
  background-color: #32B499;
  color: #fff;
  font-family: 'PingFang SC-Medium';
  margin-left: 24rpx;
  border-radius: 0.25rem;
}


.cartAddress-popup {
  height: 50vh;
  overflow-y: scroll;
  padding: 24rpx;
  color: #333333;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  font-size: 28rpx;
  background-color: #fff;
  border-radius: 40rpx 40rpx 0 0;
}

.cartAddress-popup .popup_title {
  border-bottom: 2rpx solid rgba(241, 241, 241, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  padding-bottom: 24rpx;
  box-sizing: border-box;
  font-size: 32rpx;
  font-family: 'PingFang SC-Bold';
  font-weight: bold;
}

.cartAddress-popup .popup_operate {
  display: flex;
  flex-direction: row-reverse;
  margin-bottom: 24rpx;
  padding-top: 24rpx;
  box-sizing: border-box;
}

.popup_operate>view {
  margin-left: 40rpx;
}

.cartAddress-popup section {
  flex: 1;
  overflow-y: scroll;
}

.cartAddress-popup section .address-item>view:first-child {
  flex: 1;
  display: flex;
}

.address-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32rpx;
}

.address-item .address-item-defaultImg {
  width: 2.5rem;
  height: 2.5rem;
  display: block;
}

.address-item-name {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #32B499;
  color: #fff;
  font-size: 32rpx;
  font-family: 'PingFang SC-Bold';
  border-radius: 50% 50%;
}

.address-item .address-item-info {
  flex: 1;
  padding-left: 12rpx;
  box-sizing: border-box;
  color: #999;
}

.address-item .address-item-info .address-item-info-contacts {
  display: flex;
  align-items: center;
  color: #333333;
}

.address-item-info-contacts>text:first-child {
  font-size: 32rpx;
  font-family: 'PingFang SC-Bold';
  margin-right: 10rpx;
}

.address-item-info-contacts>view:nth-child(2) {
  font-family: 'DIN-Regular';
}

.address-item-info-contacts>.default {
  border-radius: 4rpx;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 2rpx solid #32B499;
  font-size: 24rpx;
  color: #32B499;
  margin-left: 10rpx;
  padding: 0 4rpx;
  box-sizing: border-box;
}

.address-item .address-item-info-icon {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
  margin-left: 24rpx;
}

.cart-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 28rpx;
  color: #999999;
  background-color: #fff;
  border-radius: 40rpx;
}

.cart-empty>image {
  width: 620rpx;
  height: 308rpx;
  display: block;
  margin-bottom: 24rpx;
}
</style>





  